package com.neuedu.hadoop;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.IOException;
import java.util.Arrays;

public class HDFSDemo {
    public static void main(String[] args) throws IOException {
        Configuration conf = new Configuration();
        conf.set("fs.defaultFS", "hdfs://hadoop-svr-01:9000/");
        FileSystem fs = FileSystem.get(conf);

        Path path=new Path("D:\\DataProcessing\\projects_dp\\wu_hadoop\\src\\main\\resources\\text.txt");
        Path dst = new Path("/test/data_input/text.txt");

        fs.copyFromLocalFile(path, dst);

        FileStatus[] status = fs.listStatus(new Path("/test/data_input/"));
        Arrays.stream(status).forEach(System.out::println);

    }
}
